<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>心情日记已审核页面</title>
    <%@ include file="../../common/meta.jsp" %>
    <%@ include file="../../common/common-body.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
    <script src="${ctx}/js/plugins/validate/jquery.validate.custom.js?t=20181024"></script>
    <style>
        /*.form-group{*/
            /*margin-bottom: 25px;*/
        /*}*/
        .modal-body-height{
            height: 375px;
            padding-bottom: 10px;
            overflow-y: auto;
            overflow-x: hidden;
        }
        .overflow-x {
            width:430px;
            height:150px;
            overflow-x: scroll;
            overflow-y: hidden;
        }
        ul .dropdown-menu {
            padding-left: 0px;
            margin-left: 0px;
            float: left;
            text-align: center;
            width: 176px;
        }
        ul{
            list-style: none;
        }
    </style>
    <script>
         var dataStatusMap = ${dataStatusMap};
         var YesOrNo = ${YesOrNo};
    </script>
</head>
<body class="gray-bg">
<div id="vue">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="tabs-container">
            <ul class="nav nav-tabs">
                <li class="">
                    <a href="${ctx}/checkMoodDiary/moodDiaryPage" aria-expanded="true">待审核</a>
                </li>
                <li class="active">
                    <a href="${ctx}/checkMoodDiary/moodDiarySuccessPage" aria-expanded="true">已审核</a>
                </li>
            </ul>
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5><i class="fa fa-search"></i> 筛选查询</h5>
                        </div>
                        <div class="ibox-content ibox-content-search">
                            <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate">
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">查询用户：</label>
                                    <div class="col-sm-3">
                                        <input type="text" id="userId" name="userId" onkeydown="if(event.keyCode==13){doRefresh();return false;}"  class="form-control"  placeholder="输入用户ID/昵称" maxlength="30"
                                               value="${not empty bizDiaryDto ? bizDiaryDto.userId : ''}">
                                    </div>

                                    <label class="col-sm-1 control-label">状态：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="dataStatus" id="dataStatus" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${dataStatusMap}" var="item">
                                                <option value="${item.key}" ${not empty bizDiaryDto && bizDiaryDto.checkType == item.key? 'selected' : '' } >${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">是否公开：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="exoteric" id="exoteric" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${YesOrNo}" var="item">
                                                <option value="${item.key}" ${not empty bizDiaryDto && bizDiaryDto.checkType == item.key? 'selected' : '' } >${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <div class="ibox-tools ibox-tools-search">
                                        <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                        <button type="button" class="btn btn-primary btn-outline" onclick="doReset()">重置</button>
                                        <button type="button" class="btn btn-primary btn-outline" onclick="openSearchTools();"><i class="fa fa-caret-down"></i></button>
                                    </div>
                                </div>

                                <div class="search-tools">
                                    <div class="form-group">
                                        <label class="col-sm-1 control-label">操作时间：</label>
                                        <div class="col-sm-3">
                                            <input placeholder="操作时间" value="${not empty bizDiaryDto ? bizDiaryDto.diaryDate : ''}" class="form-control layer-date" id="diaryDate" name="diaryDateStr">
                                        </div>

                                        <label class="col-sm-1 control-label">查询日记：</label>
                                        <div class="col-sm-2">
                                            <input type="text" id="contents" name="contents" onkeydown="if(event.keyCode==13){doRefresh();return false;}"  class="form-control"  placeholder="请输入日记内容" maxlength="30"
                                                   value="${not empty bizDiaryDto ? bizDiaryDto.contents : ''}">
                                        </div>

                                        <label class="col-sm-1 control-label">心情：</label>
                                        <div class="col-sm-2">
                                            <ul style="padding-left:0px">
                                                <li class="dropdown">
                                                   <a style="color: #3d4d5d;" data-toggle="dropdown" href="#">
                                                    <input id="hiddenMood" type="hidden" />
                                                    <div id="inputDiv">
                                                        <select class="form-control" name="mood" id="mood">
                                                            <option value="">--请选择--</option>
                                                        </select>
                                                    </div>
                                                    <%--<span>点击选择心情</span>--%>
                                                    <%--<input id="hiddenMood" type="hidden" />--%>
                                                    <div id="imgDiv">
                                                        <img id="moodImg" name="moodImg" src="${ctx}/images/common/laugh.png" style="width: 40px;height: 40px;" class="gallery-pic" >
                                                    </div>
                                                   </a>
                                                    <ul class="dropdown-menu">
                                                        <c:forEach items="${moodMap}" var="item">
                                                            <li>
                                                                <div>
                                                                    <div style="width: 176px">
                                                                        <img src="${ctx}/images/common/${item.key}.png" style="width: 40px;height: 40px;" class="gallery-pic" onclick="selectMood('${item.key}')">
                                                                    </div>
                                                                </div>
                                                            </li>
                                                        </c:forEach>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-1 control-label">是否置顶：</label>
                                        <div class="col-sm-3">
                                            <select class="form-control" name="isTop" id="isTop" onchange="doRefresh()">
                                                <option value="">--请选择--</option>
                                                <c:forEach items="${YesOrNo}" var="item">
                                                    <option value="${item.key}" ${not empty bizDiaryDto && bizDiaryDto.isTop == item.key? 'selected' : '' } >${item.value}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5><i class="fa fa-table"></i> 审核信息</h5>
                            <div class="ibox-tools col-sm-offset-2">
                                <c:if test="${userType == 'super' || not empty btnMap['topDiary']}">
                                <button class="btn btn-primary btn-outline" onclick="doSetTop()">置顶</button>
                                </c:if>
                                <c:if test="${userType == 'super' || not empty btnMap['revokeDiary']}">
                                <button class="btn btn-primary btn-outline" onclick="doRevokeDiary()">撤销发布</button>
                                </c:if>
                                <button class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <table class='table table-striped table-hover'
                                   id="dataTable" data-height="370"
                                   data-toggle="table"
                                   data-url="${ctx}/checkMoodDiary/pageFindDiaryCheckSuccessData?t=${now}"
                                   data-pagination="true"
                                   data-side-pagination="server"
                                   data-striped="true"
                                   data-response-handler="handleServerResult"
                                   data-query-params-type=""
                                   data-query-params="getParams"
                                   data-page-number="${not empty defLogInfo.pageNo ? defLogInfo.pageNo : 1}"
                                   data-page-size="${not empty defLogInfo.pageSize ? defLogInfo.pageSize : defaultPageSize}"
                                   data-page-list="${pageList}">
                                <thead>
                                <tr>
                                    <th data-field="id" data-visible="false">主键id</th>
                                    <th data-field="score" data-visible="false">健康币记录</th>
                                    <th data-field="dataStatus" data-formatter="formatDataStatus" data-align="center" data-width="100px">状态</th>
                                    <th data-field="userId" data-align="center" data-width="100px">用户ID</th>
                                    <th data-field="name" data-align="center" data-width="100px">用户昵称</th>
                                    <th data-field="contents"  data-align="center" data-formatter="formatName" data-events="actionEvents" data-width="120px">日记内容</th>
                                    <th data-field="mood" data-formatter="formatMood"  data-align="center" data-width="100px">心情</th>
                                    <th data-field="isTop" data-formatter="formatType"  data-align="center" data-width="100px">是否置顶</th>
                                    <th data-field="topTime"  data-align="center" data-width="280px">置顶时间</th>
                                    <th data-field="topSort"  data-align="center" data-width="90px">置顶排序</th>
                                    <th data-field="gmtCreate" data-formatter="formatTime"  data-align="center" data-width="150px">提交时间</th>
                                    <th data-field="operator"  data-align="center" data-width="100px">最后操作人</th>
                                    <th data-field="gmtModify" data-formatter="formatTime"  data-align="center" data-width="150px">最后操作时间</th>
                                    <th data-field="exoteric"  data-formatter="formatType" data-align="center" data-width="90px">是否公开</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="text-center">${companyName}</div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="${ctx}/js/check/moodDiary/checkMoodDiarySuccessMgr.js?t=${now}"></script>

<div id="checkDiary" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 id="" style="font-weight: normal;">审核日记</h4>
            </div>
            <div class="modal-body modal-body-height">
                <div >
                    <span>审核结果:</span>
                    <span id="checkResult" style="margin-left:30px"></span>
                </div>
                <div style="margin-top: 10px">
                    <span id="tips" style="margin-right:30px;"></span>
                    <span id="filedReason"></span>
                </div>
                <div style="margin-top: 10px">
                    <button type="button" class="btn btn-primary btn-outline"  id="revoke"  onclick="doRevokeDiary()">撤销发布</button>
                    <span id="revokeTips"></span>
                </div>
                <h5 class="page-header page-header-new"><i class="fa fa-file-text"></i>&nbsp;&nbsp;基本信息</h5>
                <%--<div id="_div1" class="ibox-content">--%>
                <form class="form-horizontal m-t" id="contentForm" name="contentForm" autocomplete="off">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">用户ID：</label>
                        <label class="col-sm-4 control-label control-label-content" name="lab_userId" id="lab_userId"></label>

                        <label class="col-sm-2 control-label">当日心情：</label>
                        <div id="col-sm-4" >
                            <div name="lab_mood"  id="lab_mood"></div>
                        </div>
                        <%--<label class="col-sm-4 control-label control-label-content" name="lab_mood"  id="lab_mood" ></label>--%>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">习惯清单：</label>
                        <label class="col-sm-8 control-label control-label-content" name="lab_habitName"  id="lab_habitName" ></label>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">文本内容：</label>
                        <label class="col-sm-8 control-label control-label-content" name="lab_contents"  id="lab_contents" ></label>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">图片内容：</label>
                        <div class="col-sm-10">
                            <div  class="overflow-x">
                                <div id="picDiv" style="width: 2000px"></div>
                            </div>
                        </div>
                    </div>
                </form>
                <%--</div>--%>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <%--<button class="btn btn-primary" onclick="checkPassBtn()">通过</button>--%>
                <%--<button class="btn btn-danger" onclick="unCheckPassBtn()">不通过</button>--%>
                <button class="btn btn-white" onclick="$('#checkDiary').modal('hide')" >关闭</button>
            </div>
        </div>
    </div>
</div>

<div id="setTopDiary" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header text-center">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            </div>
            <div class="modal-body modal-body-height" >
                <form class="form-horizontal m-t" id="checkDiaryForm" name="checkDiaryForm" autocomplete="off">
                    <div class="form-group">
                        <input type="hidden" id="hiddenId" />
                        <input type="hidden" id="hiddenUserId" />
                        <label class="col-sm-3 control-label control-label-content">将当前日记置顶：</label>
                        <div class="col-sm-7">
                            <label style="padding-top: 7px"><input name="isTop" id="N" type="radio" value="N" />否</label>
                            <label style="margin-left: 60px;padding-top: 3px"><input name="isTop" id="Y" type="radio" value="Y" checked="checked"/>是</label>
                        </div>
                    </div>

                    <div id="topDiv">
                        <div class="form-group">
                            <label class="col-sm-3 control-label control-label-content">置顶有效期：</label>
                            <div class="col-sm-7">
                                <input placeholder="置顶有效期" class="form-control layer-date" id="topTime" name="topTime">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label control-label-content">置顶排序：</label>
                            <div class="col-sm-7">
                                <input  id="topSort" class="form-control " name="topSort" isPInteger="true">
                                <span class="help-block m-b-none tip"></span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label control-label-content">健康币奖励：</label>
                        <label class="col-sm-7 control-label control-label-content" id="_score"></label>
                    </div>
                </form>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="setDiaryTop()">保存</button>
                <button class="btn btn-white" onclick="$('#setTopDiary').modal('hide')">取消</button>
            </div>
        </div>
    </div>
</div>

<div id="setRevokeReasonPage" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 id="_modelTitle" style="text-align: center; font-weight: normal;">撤销发布</h4>
            </div>
            <div class="modal-body modal-body-height">
                <form class="form-horizontal m-t" id="_tipForm">
                    <div class="form-group">
                        <label class="col-sm-12 control-label" style="text-align: left; margin-left: 15px;"><span style="font-size: 18px; font-weight: bold">确认将选中日记撤销发布吗？</span></label>
                        <label class="col-sm-12 control-label" style="text-align: left; margin-left: 15px;"><span style="font-size: 12px; color: grey">日记撤销后会从前端下架且不可恢复，请谨慎操作哦</span></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-12 control-label" style="text-align: left; margin-left: 15px;"><span style="color: red;">*</span>撤销原因：</label>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-12">
                            <textarea id="revokeReason" name="revokeReason" maxlength="100" style="height: 100px; resize: none; width: 100%;"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="revokeDiary()">保存</button>
                <button class="btn btn-white" onclick="$('#setRevokeReasonPage').modal('hide');">取消</button>
            </div>
        </div>
    </div>
</div>

</body>
</html>
